import { app_request as request } from "@/utils/http";


export interface AttrsItemType {
    id?: number;
    attrName: string;
    categoryId: number;
    categoryLevel: number;
    attrValueList: AttrValueListType;
    // 供sku数据增加使用整合id
    AttridItemid?: string
}
export type AttrsListType = AttrsItemType[]
export interface AttrValueItemType {
    id?: number;
    valueName: string;
    attrId?: number;
    isShow?: boolean
    Nanoid?: string
}
export type AttrValueListType = AttrValueItemType[]
// 获取列表
export function getAttrsList(category1Id: number, category2Id: number, category3Id: number) {
    return request.get<null, AttrsListType>(`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`)
}
// 新增数据
export function addAttrsItem(attrInfo: AttrsItemType) {
    return request.post<null, null>(`/admin/product/saveAttrInfo`, attrInfo)
}
// 删除数据
export function deleteAttr(attrId: number) {
    return request.delete<null, null>(`/admin/product/deleteAttr/${attrId}`)
}
export interface AllattrItemtype {

    id: number,
    name: string

}
export type AllattrListtype = AllattrItemtype[]
// 获取全部销售属性列表
export function reqAttrlist() {
    return request.get<null, AllattrListtype>(`/admin/product/baseSaleAttrList`)
}
